package com.baidu.sggc.data.req;

import lombok.Data;

@Data
public class ProductUpdateReq {
  /**
   * 主键ID
   */
  private Long id;

  /**
   * 产品名
   */
  private String productName;

  /**
   * 头像Url
   */
  private String productImageUrl;

  /**
   * 简介
   */
  private String productBrief;

  /**
   * 试用地址
   */
  private String productUseUrl;

  /**
   * 标签，逗号分隔
   */
  private String tags;

  /**
   * 扩展字段，信息
   */
  private String extJson;


  /**
   * 更新人
   */
  private String updateId;

  public void validate() {
    if (id == null) {
      throw new IllegalArgumentException("id cannot be null");
    }
    if (productName == null || productName.isEmpty()) {
      throw new IllegalArgumentException("productName cannot be null or empty");
    }
    if (productImageUrl == null || productImageUrl.isEmpty()) {
      throw new IllegalArgumentException("productImageUrl cannot be null or empty");
    }
    if (productUseUrl == null || productUseUrl.isEmpty()) {
      throw new IllegalArgumentException("productUseUrl cannot be null or empty");
    }
    if (tags == null || tags.isEmpty()) {
      throw new IllegalArgumentException("tags cannot be null or empty");
    }

  }

}
